// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import "babel-polyfill"
import Element from 'element-ui'
import './assets/css/base.css'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/css/base.css'
import {getCookie} from "@/utils/utils"
import store from '@/store/index'
import Moment from 'moment'
/*import Blob from '../../vendor/Blob.js'
import Export2Excel from '../../vendor/Export2Excel.js'*/


Vue.use(Element)
Vue.prototype.moment = Moment;


router.beforeEach((to, from, next) =>{
  if (to.meta.requireAuth) {
    if(getCookie('token')) {
      next()
    } else {
      next({
        path: '/',
      })
    }
  } else {
    next()
  }
})

Vue.config.productionTip = false

/* eslint-disable no-new */
new Vue({
  el: '#app',
  store,
  router,
  render: h => h(App)
})
